package com.evola.audit.util {
	import com.evola.audit.model.AuditDay;
	
	import mx.collections.ArrayCollection;

	public class AuditDataObject {

		public var authorId : String;
		public var authorName : String;
		public var time : Date;
		public var action : String;
		public var object : String;
		public var objectId : String;
		public var shortLog : String;
		public var detailedLog : String;

		public function AuditDataObject() {
		}

		/**
		 * Metoda proverava da li se AuditDataObject nalazi medju
		 * prosledjenim AuditDay objektima u smislu da vec postoji neki
		 * AuditDay objekat za isti datum kao i tekuci AuditObject.
		 * @param auditDays
		 * @return
		 *
		 */
		public function isInDays(auditDays : ArrayCollection) : Boolean {
			var isIn : Boolean;
			//ako nema elemenata u listi onda je sigurno novi dan
			if (auditDays.length == 0) {

				isIn = false;

			} else {

				var lastAuditDay : AuditDay = auditDays.getItemAt(auditDays.length - 1) as AuditDay;
				var sameYear : Boolean = lastAuditDay.date.getFullYear() == time.getFullYear();
				var sameMonth : Boolean = lastAuditDay.date.getMonth() == time.getMonth();
				var sameDay : Boolean = lastAuditDay.date.getDate() == time.getDate();

				isIn = sameYear && sameMonth && sameDay;
			}
			// TODO Auto Generated method stub
			return isIn;
		}
	}
}
